<template>
  <el-dialog
    append-to-body
    :close-on-click-modal="false"
    :before-close="crud.cancelCU"
    :visible="crud.status.cu > 0"
    :title="crud.status.title"
    width="500px"
  >
    <el-form
      ref="form"
      :model="form"
      size="small"
      label-width="80px"
    >
      <el-form-item
        label="图书名称"
        prop="name"
      >
        <el-input
          v-model="form.name"
          style="width: 370px;"
        />
      </el-form-item>

      <el-form-item
        label="图书分类"
        prop="categoryId"
      >
        <el-input
          v-model="form.categoryId"
          style="width: 370px;"
        />
      </el-form-item>

      <el-form-item
        label="作者"
        prop="author"
      >
        <el-input
          v-model="form.author"
          style="width: 370px;"
        />
      </el-form-item>

      <el-form-item
        label="出版社"
        prop="publisher"
      >
        <el-input
          v-model="form.publisher"
          style="width: 370px;"
        />
      </el-form-item>

      <el-form-item
        label="数量"
        prop="count"
      >
        <el-input
          v-model="form.count"
          style="width: 370px;"
        />
      </el-form-item>

      <el-form-item
        label="可借天数"
        prop="enableDay"
      >
        <el-input
          v-model="form.enableDay"
          style="width: 370px;"
        />
      </el-form-item>

      <el-form-item
        label="可借数量"
        prop="enableNum"
      >
        <el-input
          v-model="form.enableNum"
          style="width: 370px;"
        />
      </el-form-item>

      <el-form-item
        label="简述"
        prop="description"
      >
        <el-input
          v-model="form.description"
          style="width: 370px;"
        />
      </el-form-item>

      <el-form-item
        label="详细描述"
        prop="description"
      >
        <el-input
          v-model="form.description"
          style="width: 370px;"
        />
      </el-form-item>

    </el-form>
    <div
      slot="footer"
      class="dialog-footer"
    >
      <el-button
        type="text"
        @click="crud.cancelCU"
      >
        取消
      </el-button>
      <el-button
        :loading="crud.cu === 2"
        type="primary"
        @click="crud.submitCU"
      >
        确认
      </el-button>
    </div>
  </el-dialog>
</template>

<script>
  import CRUD, { form } from '@crud/crud'
  import '@riophae/vue-treeselect/dist/vue-treeselect.css'

  const defaultForm = {
    id: null,
    title: '',
    addBy: '',
    img: '',
  }
  export default {
    mixins: [form(defaultForm)],
    props: {

    },
    data() {
      return {

      }
    },
    methods: {
      [CRUD.HOOK.beforeToCU]() {

      },
      // 提交前的验证
      [CRUD.HOOK.afterValidateCU]() {

        return true
      }
    }
  }
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  /deep/ .el-input-number .el-input__inner {
    text-align: left;
  }
</style>
